home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / graphics / gnuplot / contrib / russo / popen_rw.3 < prev    next >
Encoding:
Text File  |  1992-03-25  |  5.2 KB  |  133 lines

  1.  
  2.  
  3.  
  4.      PPPPOOOOPPPPEEEENNNN____RRRRWWWW((((3333LLLL))))    UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((22229999 NNNNoooovvvveeeemmmmbbbbeeeerrrr 1111999999991111))))     PPPPOOOOPPPPEEEENNNN____RRRRWWWW((((3333LLLL))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.           popen_rw, pclose_rw - open or close pipes (for I/O) to and
  10.           from a process
  11.  
  12.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.           ####iiiinnnncccclllluuuuddddeeee """"ppppooooppppeeeennnn....hhhh""""
  14.  
  15.           FFFFIIIILLLLEEEE ********ppppooooppppeeeennnn____rrrrwwww((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****ccccoooommmmmmmmaaaannnndddd))))
  16.  
  17.           iiiinnnntttt ppppcccclllloooosssseeee____rrrrwwww((((FFFFIIIILLLLEEEE ********ssssttttrrrreeeeaaaammmm))))
  18.  
  19.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  20.           The argument to ppppooooppppeeeennnn____rrrrwwww(((()))) is a pointer to a NULL-terminated
  21.           string containing a shell command line.  ppppooooppppeeeennnn____rrrrwwww(((()))) creates
  22.           2 pipes between the calling process and the command to be
  23.           executed for bi-directional communication, one for reading
  24.           from stdout and one for writing to stdin.  The value
  25.           returned is an array of 2 stream pointers such that one can
  26.           write to the standard input of the command by writing to the
  27.           file stream[1]; and one can read from the standard output of
  28.           the command by reading from the file stream[0].
  29.  
  30.           A stream opened by ppppooooppppeeeennnn____rrrrwwww(((()))) should be closed by
  31.           ppppcccclllloooosssseeee____rrrrwwww(((()))), which waits for the associated process to
  32.           terminate and returns the exit status of the command.
  33.  
  34.           Because open files are shared the command may be used as an
  35.           input filter, reading its standard input (which is also the
  36.           standard output of the process doing the ppppooooppppeeeennnn____rrrrwwww) and
  37.           providing filtered input on the stream.  At the same time
  38.           the command may be used as an output filter, reading a
  39.           stream of output written to the stream process doing the
  40.           ppppooooppppeeeennnn____rrrrwwww(((()))) and further filtering it and writing it to its
  41.           standard output (which is also the standard input of the
  42.           process doing the ppppooooppppeeeennnn____rrrrwwww).
  43.  
  44.           ppppooooppppeeeennnn____rrrrwwww(((()))) always calls sssshhhh(1), never ccccsssshhhh(1).
  45.  
  46.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  47.           ccccsssshhhh(1), sssshhhh(1), ppppiiiippppeeee(2), wwwwaaaaiiiitttt(2), ffffcccclllloooosssseeee(3S), ffffooooppppeeeennnn(3S),
  48.           ssssyyyysssstttteeeemmmm(3), ppppooooppppeeeennnn____iiiiooooeeee(3L)
  49.  
  50.      DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  51.           ppppooooppppeeeennnn____rrrrwwww(((()))) returns a NULL pointer if the pipe or process
  52.           cannot be created, or if it cannot allocate as much memory
  53.           as it needs.
  54.  
  55.           ppppcccclllloooosssseeee____rrrrwwww(((()))) returns -1 if stream is not associated with a
  56.           `ppppooooppppeeeennnn____rrrrwwwwed' command.
  57.  
  58.      BBBBUUUUGGGGSSSS
  59.           If the original and `ppppooooppppeeeennnn____rrrrwwwwed' processes concurrently read
  60.  
  61.  
  62.  
  63.      Page 1                                         (printed 12/10/91)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      PPPPOOOOPPPPEEEENNNN____RRRRWWWW((((3333LLLL))))    UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((22229999 NNNNoooovvvveeeemmmmbbbbeeeerrrr 1111999999991111))))     PPPPOOOOPPPPEEEENNNN____RRRRWWWW((((3333LLLL))))
  71.  
  72.  
  73.  
  74.           or write a common file, neither should use buffered I/O,
  75.           because the buffering gets all mixed up.  Similar problems
  76.           with an output filter may be forestalled by careful buffer
  77.           flushing, for instance, with fffffffflllluuuusssshhhh; see ffffcccclllloooosssseeee(3S).
  78.  
  79.      AAAAUUUUTTTTHHHHOOOORRRR
  80.           Kevin Russo, SFA, Inc. / US Naval Research Lab, Code 5133
  81.           russo@orion.nrl.navy.mil
  82.  
  83.           Based on BSD4.3 code by Ken Arnold.
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                                         (printed 12/10/91)
  130.  
  131.  
  132.  
  133.